package com.adaxi.adc.business.passengertrip.controller;


import com.adaxi.adc.business.passengertrip.feign.service.IVehicleTripFeignService;
import com.adaxi.adc.business.passengertrip.pojo.AdcRoutePrice;
import com.adaxi.adc.business.passengertrip.pojo.AdcVehicleTrip;
import com.adaxi.adc.common.common.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@Api(value = "车辆行程关联价格表接口文档",tags = "车辆行程关联价格表接口文档")
@RestController
@EnableTransactionManagement
public class RoutePriceController {
    @Autowired
    RocketMQTemplate rocketMQTemplate;
    @Autowired
    IVehicleTripFeignService iRoutePriceFeignService;//注入feign中路线价格表的service


    @ApiOperation("车辆行程关联价格表")
    @GetMapping("/VehicleTripAndPrice/{id}")
    @Transactional
    public CommonResult queryById(@PathVariable("id")String id){
        CommonResult<AdcVehicleTrip> result1=iRoutePriceFeignService.queryById(id);
        AdcVehicleTrip vehicleTrip=result1.getData();
        String id1=vehicleTrip.getVehicle_route_id();
        System.out.println(id1);
        CommonResult<AdcRoutePrice>  result2=iRoutePriceFeignService.queryVARById(id1);
        if(result1.isSuccess()&&result2.isSuccess()){
            AdcRoutePrice routePrice=result2.getData();
            vehicleTrip.setAdcRoutePrice(routePrice);
        }
        return CommonResult.SUCCESS("查询成功",vehicleTrip);
    }
}
